package com.lqs.dataservice.Controller;

import com.coxautodev.graphql.tools.GraphQLMutationResolver;
import com.coxautodev.graphql.tools.GraphQLQueryResolver;
import com.lqs.dataservice.Service.UserService;
import com.lqs.dataservice.entity.Army;
import com.lqs.dataservice.entity.User;
import com.nip.db.mongodb.utils.tips.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * ArmyController
 *
 * @author < a href=" ">BBB</ a>
 * @version v1.0.01
 * @date 2019-12-27 14:45
 */
@Component
public class UserController implements GraphQLQueryResolver, GraphQLMutationResolver {
  @Autowired
  UserService userService;

  public List<User> findAllUser() {
    return userService.findAllUser();
  }

  public List<User> findAllUserByRemark(String remark) {
    return userService.findAllUserByRemark(remark);
  }

  public User findUserById(String id) {
    return userService.findUserById(id);
  }

  public User findUserByCode(String code) {
    return userService.findUserByCode(code);
  }

  public Response loginUser(String code,String password){
    return userService.login(code,password);
  }

  public Response saveUser(User entity) {
    return userService.saveUser(entity);
  }

  public Response saveUserPassword(User entity) {
    return userService.saveUserPassword(entity);
  }

  public Response deleteUsers(List<String> ids) {
    return userService.deleteUsers(ids);
  }

  public List<User> findAllByUserParentId(String id) {
    return userService.findAllByUserParentId(id);

  }
  public List<User> findAllByUserParentIdAndRemark(String id,String remark) {
    return userService.findAllByUserParentIdAndRemark(id,remark);
  }


}
